#include <iostream>
#include <set>

struct Person {
    int height;
    int weight;
    int age;

    bool operator < (const Person& other) const {
        if (height != other.height) {
            return height < other.height;
        }
        if (weight != other.weight) {
            return weight < other.weight;
        }
        return age < other.age;
    }
};

/**
 * 破案
 * @return
 */
int main() {
    std::set<Person> people;

    int n, m;
    std::cin >> n >> m;

    for (int i = 0; i < n; i++) {
        Person p;
        std::cin >> p.height >> p.weight >> p.age;
        people.insert(p);
    }

    for (int i = 0; i < m; i++) {
        Person p;
        std::cin >> p.height >> p.weight >> p.age;
        if (people.count(p)) {
            std::cout << "yes\n";
        }
        else {
            std::cout << "no\n";
        }
    }


    return 0;
}